Fix #2989: dcc.Dropdown options order preserved during search#3680
Fix #2989: dcc.Dropdown options order preserved during search#3680ines-om wants to merge 2 commits intoplotly:devfrom
Conversation
|
Hi @ines-om Thanks for this PR! Since this changes the current search ordering, it would be safer to make it opt-in by adding a new prop, for example: search_order="original" | "index"where original preserves the input options order, and index matches the current behavior (and remains the default). This keeps backward compatibility and also leaves room for future improvements, for example adding a "ranking" mode as in PR #3573 |
When searching in dcc.Dropdown, results should maintain the original option order instead of being reordered by js-search. By creating a Set of search results and filtering the original options array, we preserve order while maintaining performance.
4378ac8 to
54cd282
Compare
…wn result ordering - Adds new search_order prop with 'index' (default) and 'original' options ordering - Changed 4 integration tests to include new prop
|
Hi @AnnMarieW Thank you for the feedback! I’ve updated the PR to include the I have verified the implementation and confirmed that the tests added only pass with I hope this implementation is well aligned with the 'ranking' mode PR #3573. Let me know if I should add or change anything! |
|
I also ran some examples based on this PR and it looks good thanks @ines-om Next steps:
|
This PR fixes #2989.
When searching in
dcc.Dropdown, search results should be presented in the original option order instead of being reordered byjs-search. This is achieved by creating a Set of the search results and filtering the original options array against it, preserving the intended order.Contributor Checklist
DropdownSearch.tsxto preserve user-defined order in search resultsoptionals
CHANGELOG.md